package com.jservice.api.service.smk;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.jservice.api.MsgCode;
import com.jservice.api.dto.Request;
import com.jservice.api.dto.Response;
import com.jservice.api.dto.ResponseHeader;
import com.jservice.api.service.BaseService;
import com.jservice.api.service.IService;
import com.jservice.framework.utils.StringUtils;
import com.jservice.model.SmkNews;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * Smk0013 - 首页资讯 详情页
 *
 * @Author cwledit
 * @DATE 2017/6/17.
 */
@Service("smk0013")
public class Smk0013 extends BaseService implements IService{
    @Override
    public Response excute(Request request, Response response, ResponseHeader header, String method) throws Exception {
        Map paramMap =  request.getData();
        String id = paramsStringFilter(paramMap.get("id"));
        if (StringUtils.isEmpty(id)){
            return renderFAIL(MsgCode.Code_1008,"参数错误",response,header);
        }
        String sql = "select * from "+ SmkNews.TABLE_NAME+" where id = ?";
        Record record = Db.findFirst(sql,id);

//        SmsService.me().save("330303198701221219","您尾号1029的市民卡账户2016-12-10日16:48:30电子钱包充值撤销-0.01元，余额以卡面为准。详询96225");

        return renderSUC(record,response,header);
    }
}
